package 常用类.Array类.map.map课后练习;

import java.util.Random;

public class Account {
    private long id;
    private double balance;
    private String password;

    public Account() {
        System.out.println("构造方法被执行");
    }

    //静态代码块（只执行一次）
    static {

    }

    //初始化代码块（在构造方法被调用前自动执行）
    //自动分配id
    {
        int num=new Random().nextInt(100);//0-100
        this.id=Long.valueOf(num+1);//1-101
    }

    public Account(String password,double balance) {
        this.password = password;
        this.balance = balance;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }
}
